﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// 文件名：ClsAnnunciatorDAL.cs
/// 作  者：黄纲
/// 时  间：2007.01.31
/// 说  明：ClsAnnunciatorDAL类用于系统预警信息相关处理
/// </summary>
public class ClsAnnunciatorDAL
{
    /// <summary>
    /// 数据库连接字符串
    /// </summary>
    private static string strSqlConnectionString = ConfigurationManager.AppSettings["SQLCONNECTIONSTRING"];

    /// <summary>
    /// 获取预警信息
    /// </summary>
    /// <param name="Type"></param>
    /// <returns></returns>
    public DataSet GetAnnunciatorDataSet(int Type)
    {
        string strPro_Name = "";

        if (Type == 0)
        {
            strPro_Name = "Pro_GetAnnunciatorDataSet0";
        }

        DataSet dst = new DataSet();
        SqlConnection con = new SqlConnection(strSqlConnectionString);
        SqlDataAdapter dat = new SqlDataAdapter(strPro_Name, con);

        dat.SelectCommand.CommandType = CommandType.StoredProcedure;

        try
        {
            dat.Fill(dst);
        }
        catch
        {
            dst = null;
        }
        finally
        {
            if (con.State == ConnectionState.Open)
            {
                con.Close();
            }
        }

        return dst;
    }
}
